[pull] master from tensorflow:master#1689
Merged
Merged
Conversation
PiperOrigin-RevId: 893813399
PiperOrigin-RevId: 893825872
Imported from GitHub PR openxla/xla#40329 Replaces the single integer-based `ExecutionStreamId` with a `std::variant<ComputationStreamId, CommunicationStreamId>` that encodes the stream kind in the type itself, eliminating the need for a separate `AsyncKind` enum and simplifying the execution stream assignment and thunk emission pipeline. ### Key changes - **`execution_stream_id.h` (new)**: Introduces `ComputationStreamId` and `CommunicationStreamId` as strongly-typed int types, and `ExecutionStreamId` as a `std::variant` alias. - **`async_thunk.h/cc`**: Replaces `AsyncKind` enum with `ExecutionStreamId` in constructor. - **`execution_stream_assignment.h/cc`**: Simplified to only assign streams to scope-start operations (structured concurrency). Removed `AsyncExecutionStreamIds`, `GetSyncExecutionStreamId`, `GetAsyncExecutionStreamIds`. New API: `GetExecutionStreamId(instr)` returns `StatusOr<ExecutionStreamId>`. Renamed `kCollective` to `kCommunication` for consistency. - **`thunk_emitter.cc`**: All `AsyncStartThunk` construction sites now obtain `ExecutionStreamId` from `ExecutionStreamAssignment::GetExecutionStreamId()` and pass it directly to the constructor. Removed all `set_execution_stream_id()` calls and `AsyncKind` references. - **`gpu_executable.cc`**: Replaced `flat_hash_set<ExecutionStreamId>` stream scanning with `GetNumAdditionalComputeStreams()` that walks `AsyncStartThunk`s. Additional compute streams are now borrowed as a `std::vector<se::Stream*>` indexed by `ComputationStreamId`. - **`thunk.h/cc`**: Removed `ExecutionStreamIdMap`, `kDefaultExecutionStreamId`, `execution_stream_id` from `ThunkInfo`, and `set_execution_stream_id` from `Thunk`. ### Motivation The old design conflated stream identity with stream kind, requiring runtime checks and mutable state on thunks. The variant-based approach makes the distinction compile-time safe, removes mutable stream ID state from thunks, and aligns the execution stream assignment with structured concurrency (only scope-start operations need stream IDs). Copybara import of the project: -- ea6a0c02825441bbb8949f45f7bf64b913eb6746 by Eugene Zhulenev <ezhulenev@openxla.org>: [xla:gpu] Cleanup execution stream id in GPU runtime Merging this change closes #40329 PiperOrigin-RevId: 893865189
… to IFRT IR PiperOrigin-RevId: 893890790
PiperOrigin-RevId: 893894990
PiperOrigin-RevId: 893900816
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
See Commits and Changes for more details.
Created by
pull[bot] (v2.0.0-alpha.4)
Can you help keep this open source service alive? 💖 Please sponsor : )